package com.system.listener;




import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.apache.commons.fileupload.ProgressListener;
import org.springframework.stereotype.Component;

@Component
public class FileUploadProgressListener implements ProgressListener {
	private HttpSession session;
	public FileUploadProgressListener() {}
	public FileUploadProgressListener(HttpSession session) {
		this.session=session;

	}


	/**
	 * pBytesRead 到目前为止读取文件的比特数 pContentLength 文件总大小
	 */

	public void update(long pBytesRead, long pContentLength) {

	}


	public void update2(long pBytesRead, long pContentLength, String fileName){

	}




	@Override
	public void update(long pBytesRead, long pContentLength, int pItems) {
		Progress status = new Progress();
		status.setpBytesRead(pBytesRead);
		status.setpContentLength(pContentLength);
		session.setAttribute("status", status);

	}
}
